package com.pai4j.connect;
import com.pai4j.common.util.SpringContextUtil;
import com.pai4j.connect.messagequeue.consumer.redis.ChatNotifyRedisQueueListener;
import com.pai4j.connect.messagequeue.consumer.redis.InteractionNotificationRedisQueueListener;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.retry.annotation.EnableRetry;
import org.springframework.scheduling.annotation.EnableScheduling;


@SpringBootApplication
@EnableFeignClients("com.pai4j.remote")
@ComponentScan("com.pai4j")
@EnableScheduling
@EnableRetry
public class Pai4jConnectApplication {

    public static void main(String[] args) {

        SpringApplication.run(Pai4jConnectApplication.class, args);
        // 启动聊天通知消费任务
        new Thread(() -> SpringContextUtil.getBean(ChatNotifyRedisQueueListener.class).consumeTask()).start();
        // 启动互动通知消费任务
        new Thread(() -> SpringContextUtil.getBean(InteractionNotificationRedisQueueListener.class).consumeTask()).start();
    }

}
